﻿using System;
using System.Collections.Generic;

using System.Text;

namespace System.Qizx.Xml
{
    /*******************************/
    /// <summary>
    /// This class is created for emulates the SAX LocatorImpl behaviors.
    /// </summary>
    public class XmlSaxLocatorImpl : XmlSaxLocator
    {
        /// <summary>
        /// This method returns a new instance of 'XmlSaxLocatorImpl'.
        /// </summary>
        /// <returns>A new 'XmlSaxLocatorImpl' instance.</returns>
        public XmlSaxLocatorImpl()
        {
        }

        /// <summary>
        /// This method returns a new instance of 'XmlSaxLocatorImpl'.
        /// Create a persistent copy of the current state of a locator.
        /// </summary>
        /// <param name="locator">The current state of a locator.</param>
        /// <returns>A new 'XmlSaxLocatorImpl' instance.</returns>
        public XmlSaxLocatorImpl(XmlSaxLocator locator)
        {
            setPublicId(locator.getPublicId());
            setSystemId(locator.getSystemId());
            setLineNumber(locator.getLineNumber());
            setColumnNumber(locator.getColumnNumber());
        }

        /// <summary>
        /// This method is not supported, it is included for compatibility.
        /// Return the saved public identifier.
        /// </summary>
        /// <returns>The saved public identifier.</returns>
        public virtual string getPublicId()
        {
            return publicId;
        }

        /// <summary>
        /// This method is not supported, it is included for compatibility.
        /// Return the saved system identifier.
        /// </summary>
        /// <returns>The saved system identifier.</returns>
        public virtual string getSystemId()
        {
            return systemId;
        }

        /// <summary>
        /// Return the saved line number.
        /// </summary>
        /// <returns>The saved line number.</returns>
        public virtual int getLineNumber()
        {
            return lineNumber;
        }

        /// <summary>
        /// Return the saved column number.
        /// </summary>
        /// <returns>The saved column number.</returns>
        public virtual int getColumnNumber()
        {
            return columnNumber;
        }

        /// <summary>
        /// This method is not supported, it is included for compatibility.
        /// Set the public identifier for this locator.
        /// </summary>
        /// <param name="publicId">The new public identifier.</param>
        public virtual void setPublicId(string publicId)
        {
            this.publicId = publicId;
        }

        /// <summary>
        /// This method is not supported, it is included for compatibility.
        /// Set the system identifier for this locator.
        /// </summary>
        /// <param name="systemId">The new system identifier.</param>
        public virtual void setSystemId(string systemId)
        {
            this.systemId = systemId;
        }

        /// <summary>
        /// Set the line number for this locator.
        /// </summary>
        /// <param name="lineNumber">The line number.</param>
        public virtual void setLineNumber(int lineNumber)
        {
            this.lineNumber = lineNumber;
        }

        /// <summary>
        /// Set the column number for this locator.
        /// </summary>
        /// <param name="columnNumber">The column number.</param>
        public virtual void setColumnNumber(int columnNumber)
        {
            this.columnNumber = columnNumber;
        }

        // Internal state.
        private string publicId;
        private string systemId;
        private int lineNumber;
        private int columnNumber;
    }
}
